<?php
require_once("../lib/func.autoloader.php");
// mysettings.php
// User settings page
// Copyright 2007, Alex McClung
$sc = new SuperConstructor();

// If the user is not logged in, redirect them to the login page
if(false === $sc->getUser()) { header("Location: {$sc->config->LoginPage}"); exit(); }

// Was POST data submitted?
if(count($_POST) > 0)
{
	// Load POST data into the object
	$sc->LoadFormData($_POST, $sc->user);
	
	// If there are no errors, go ahead and update the record
	if(MQ::NumMessages(MQ_ERROR) == 0)
	{
		if($sc->user->Update())
		{
			MQ::OK("Your settings have been saved.");
		}
	}
}

// Assign template vars
$sc->assign("pageTitle", "My Settings");
$sc->assign_by_ref("user", $sc->user);

// Show the template
$sc->display("admin/pages/mysettings.tpl");
?>